package com.yhos.platform.oopston.service.biz;

import com.yhos.platform.oopston.base.constants.CommonConstants;
import com.yhos.platform.oopston.core.mybatis.CommonMapper;
import com.yhos.platform.oopston.mapper.entity.OopstonOrder;
import com.yhos.platform.oopston.mapper.mapper.OopstonOrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

@Service
public class OrderOperateBiz {

    @Autowired
    private OopstonOrderMapper oopstonOrderMapper;

    @Autowired
    private CommonMapper commonMapper;

    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public void updateOrderCancelStatus(Long orderId) {
        OopstonOrder updateOrder = new OopstonOrder();
        updateOrder.setId(orderId);
        updateOrder.setCancelStatus(CommonConstants.BYTE_ONE);
        commonMapper.setBaseEntityModify(updateOrder, CommonConstants.LONG_ONE);
        oopstonOrderMapper.updateById(updateOrder);
    }

}
